let server = 'http://localhost:8080';

function getPersons(params) {
    $.ajax({
        method: 'get',
        url: server + '/person/query',
        async: false,
        dataType: 'json',
        success: function(response) {
            switch (response.code) {
                case '200':
                    let persons = response.data;
                    let html = '';
                    $.each(persons, function(index, person) {
                        // window.console.log(person);
                        let age = idCardUitl.getAge(person.idCard);
                        let gender = (idCardUitl.getGender(person.idCard) == 1) ? '男' : '女';
                        let birthday = idCardUitl.getBirthday(person.idCard);
                        html += '<tr align="center" class="data_item">';
                        html += '<td><input type="checkbox" name="id" class="form-check" value="' + person.id + '"></td>';
                        html += '<td>' + person.name + '</td>';
                        html += '<td>' + age + '</td>';
                        html += '<td>' + gender + '</td>';
                        html += '<td>' + birthday + '</td>';
                        html += '</tr>';
                        $('#data_items').html(html);
                    });
                    break;

                default:
                    break;
            }
        },
        error: function() {
            window.console.log('服务器大大病了');
        }
    });
}
getPersons();